//
//  BusinessInfoCollectTextCell.m
//  BaseProject
//
//  Created by 王洋 on 2020/10/21.
//  Copyright © 2020 王洋. All rights reserved.
//

#import "BusinessInfoCollectTextCell.h"

@implementation BusinessInfoCollectTextCell

- (void)awakeFromNib {
    [super awakeFromNib];

    self.contentView.backgroundColor = [UIColor whiteColor];

}

- (void)layoutSubviews {
    
    [super layoutSubviews];
    
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        
        if (self.model.isSel) {
            [self pp_clipCorners:UIRectCornerAllCorners radius:self.frame.size.width/2 border:0.5 color:UIColorHex(0xff4242)];

        } else {
            [self pp_clipCorners:UIRectCornerAllCorners radius:self.frame.size.width/2 border:0.5 color:UIColorHex(0xc1c1c1)];

        }

    });
}

- (void)fillCellWithModel:(BusinessInfoCollectModel *)model {
    
    self.model = model;
    self.itemTitleLab.text = self.model.title;

    if (self.model.isSel) {
        
        self.itemTitleLab.textColor = UIColorHex(0xFF4242);
//        self.backgroundColor = UIColorHex(0xFF4242);
//        self.contentView.backgroundColor = UIColorHex(0xFF4242);

    } else {
        
        self.itemTitleLab.textColor = UIColorHex(0x333333);
//        self.backgroundColor = UIColorHex(0xf1f1f1);
//        self.contentView.backgroundColor = UIColorHex(0xf1f1f1);

    }
}

- (BusinessInfoCollectModel *)model {
    if (!_model) {
        _model = [[BusinessInfoCollectModel alloc] init];
    }
    return _model;
}

@end
